﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;
using Astor.Common;
using Astor.Modules.DataSources;
using Microsoft.Practices.Prism.UnityExtensions;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Prism.Modularity;

namespace Astor.Shell
{
    public class AstorBootstrapper : UnityBootstrapper
    {
        //protected override void ConfigureAggregateCatalog()
        //{
        //    this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(AstorBootstrapper).Assembly));
        //    this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(AstorCommands).Assembly));
        //    this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(DataSourcesModule).Assembly));
        //}

        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();

            //this.Container.RegisterType(typeof(Shell));
        }

        protected override void InitializeShell()
        {
            base.InitializeShell();
            Application.Current.RootVisual = (Shell)this.Shell;
        }

        protected override DependencyObject CreateShell()
        {
            return this.Container.Resolve<Shell>();
        }

        protected override IModuleCatalog  CreateModuleCatalog()
        {
            ModuleCatalog ctlg = new ModuleCatalog();
            ctlg.AddModule(typeof(DataSourcesModule));
            return ctlg;
        }
    }
}
